﻿using KingerRobot.MexicoSailunMES.Dao;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace KingerRobot.MexicoSailunMES.Spi;
public interface IMesService
{
    
    InCuringDto GetInCuringInfo(string tireCode);
    /// <summary>
    /// 获取所有可请料硫化信息
    /// </summary>
    /// <returns></returns>
    List<TcmInfo> GetAllInCuringInfos();
    /// <summary>
    /// 获取物料信息
    /// </summary>
    /// <returns></returns>

    List<TcmInfo> GetRequestMaterialInfos();

    /// <summary>
    /// 获取所有请料硫化信息(wms页面使用)
    /// </summary>
    /// <returns></returns>
    List<TcmInfo> GetWMSAllInCuringInfos();
    /// <summary>
    /// 获取所有未同步的产品信息
    /// </summary>
    /// <returns></returns>
    List<BcdInfoBean> GetMesNoSyncProduct();
    /// <summary>
    /// 获取所有未同步的锁定信息
    /// </summary>
    /// <returns></returns>
    List<HoldReqInfoBean> GetMesNoSyncHoldReq();

    List<TcmStatusBean> GetTcmStatus();

    int AddOutEnds(List<EndParam> endParams);
    /// <summary>
    /// 根据胎胚条码获取胎胚信息
    /// </summary>
    /// <param name="tireCode"></param>
    /// <returns></returns>
    InCuringDto GetTireInfos(string tireCode);
    /// <summary>
    /// 根据生产机台获取产品信息
    /// </summary>
    /// <param name="tbmNos"></param>
    /// <returns></returns>
    List<ProductInfoBean> GetNotSyncProductInfosByTbmNos(List<string> tbmNos);
    /// <summary>
    /// 根据机台号获取产品信息
    /// </summary>
    /// <param name="bcdNo"></param>
    /// <returns></returns>
    ProductInfoBean GetProductInfosByBcdNo(string bcdNo);
    /// <summary>
    /// 根据条码回写入库信息
    /// </summary>
    /// <param name="bcdNo"></param>
    /// <param name="LocCode"></param>
    /// <returns></returns>
    int AddInEndByBcdNos(string bcdNo, string LocCode);
    /// <summary>
    /// 更新胎胚信息，同步标志
    /// </summary>
    /// <param name="bcdNos"></param>
    /// <returns></returns>
    int UpdateBcdInfoRcvFlag(string bcdNo);
    /// <summary>
    /// 获取锁定数据
    /// </summary>
    /// <returns></returns>
    List<BcdLockInfo> GetLocInfos();
    /// <summary>
    /// 根据条码获取锁定信息
    /// </summary>
    /// <param name="barCodes"></param>
    /// <returns></returns>
    List<BcdLockInfo> GetLocInfosByProductCodes(List<string> barCodes);
    /// <summary>
    /// 更新锁定，同步标志
    /// </summary>
    /// <param name="bcdNo"></param>
    /// <returns></returns>
    int UpdateHoldReqRcvFlag(string bcdNo);
    /// <summary>
    /// 
    /// </summary>
    /// <param name="tcminfo"></param>
    /// <returns></returns>
    int UpdateSpecRcvFlag(TcmInfo tcminfo);

    /// <summary>
    /// 添加入库完成
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    int AddInEnd(ProductInfoBean info);

    int AddOutEnd(EndParam param);
    /// <summary>
    /// 获取硫化机状态
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    List<CuringStatusBean> GetCuringStatusBeans(CuringStatusParam param);
    /// <summary>
    /// 获取出库订单
    /// </summary>
    /// <returns></returns>

    List<Bean> GetAllOrderInfos();
}
public class Bean
{
    public POTcmGtReq Req { get; set; }
    public POTcmGtSpec Spec { get; set; }
}
public class BcdInfoBean
{

    public string BcdNo { get; set; }

    public string TbmSpec { get; set; }

    public string TbmSpecDesc { get; set; }

    public string TbmSpecVer { get; set; }

    public DateTime? TbmExpirationTime { get; set; }

    public string TbmPs { get; set; }

    public string TbmNo { get; set; }

    public DateTime? ProdDt { get; set; }

    public decimal? StdWt { get; set; }

    public decimal? MinWt { get; set; }

    public decimal? MaxWt { get; set; }

    public string InPermit { get; set; }

    public string RcvFlag { get; set; }

    public DateTime? RegDt { get; set; }

    public string Rfid { get; set; }

    public string Relateequipmen { get; set; }

    public string Remarks { get; set; }

    public int? HEIGHT { get; set; }


    public DateTime? CreateTime { get; set; }

    public DateTime? UpdateTime { get; set; }

    public int? UseFlag { get; set; }
}

public class HoldReqInfoBean 
{

    public string BcdNo { get; set; }

    public string ErrCd { get; set; }

    public string ErrDesc { get; set; }

    public string RcvFlag { get; set; }

    public DateTime? UpdDt { get; set; }

    public DateTime? RegDt { get; set; }
}
public class TcmStatusBean
{
    public string TCM_NO { get; set; }

    /// <summary>
    ///  ‘L’ 左, ‘R’ 右
    /// </summary>
    public string TCM_DIR { get; set; }

    public string TCM_SPEC { get; set; }

    public string TCM_SPEC_DESC { get; set; }
    /// <summary>
    /// 机械臂有无 GT 标记，每个硫化机加载收台货物无有(存在不存在)GT。‘N’=没有 GT，‘Y’= 有 GT，‘X’=禁止使用
    /// </summary>
    public string LD_GT { get; set; }

    /// <summary>
    /// 硫化机存胎器有无胎胚。每个硫化机收台货物无有(存在不存在)GT。‘N’=没有 GT，‘Y’= 有 GT，‘X’=禁止使用
    /// </summary>
    public string CV_GT { get; set; }

    /// <summary>
    /// 硫化机台是否需要 GT。硫化机生产 GT 请求（表示 GT 是否要料指令）。‘N’=不需要 GT，‘Y’=需要 GT，‘X’=禁止使用（如机台停机 ）
    /// </summary>
    public string GT_REQ { get; set; }

    /// <summary>
    /// 创建日期。YYYYMMDDHHMMSS’（数据库自己生成）
    /// </summary>
    [Column("REG_DT")]
    public DateTime? REG_DT { get; set; }

    /// <summary>
    /// 预计开模时间。YYYYMMDDHHMMSS’
    /// </summary>
    public DateTime? SULFOPEN_TIME { get; set; }

    /// <summary>
    /// 硫化机是否请料
    /// </summary>
    public string RcvFlag { get; set; }
}